<template>
	<view  class="uni-container">

			<view  class="uni-panel-h" v-for="(item ,index) in richlist"
				@click="goDetailPage(item)">
				<text class="uni-panel-text">{{item.zbzl}}</text>
				<text class="uni-panel-icon uni-icon">&#xe470;</text>
			</view>
			<view  class="uni-panel-h" 	@click="goDetailPage()">
				<text class="uni-panel-text" style="text-align: center;">新增植被种类</text>
				<text class="uni-panel-icon uni-icon">&#xe67b;</text>
				</view>
	</view>
</template>

<script>
	import {
		getInfo,
		setInfo
	} from '@/core/unicommon/storyageInfo.js'
	export default {
		data() {
			return {
				richlist:[],
				ydNumber:"",
				grasstype:false
			}
		},
		onLoad(e){
			if(e && e.data){
				console.log(e)
				let data=decodeURIComponent(e.data)
				this.ydNumber=data
				getInfo("userdata").then(res=>{
					console.log("111",res)
					this.richlist=res.data.rich.filter(t=>t.ydNumber==data)

				})
				
			}
			
		},
		methods: {
			getNetWork() {
				let that = this
				uni.getNetworkType({
					success: res => {
						if (res.networkType === 'none') {
							that.network = false
						} else {
							that.network = true
						}
					}
				})
			},
			goDetailPage(item){
				if(item){
					item.type='view'
					uni.navigateTo({
						url: "/pages/sampleplot/sampleplot/richness?data="+ encodeURIComponent(JSON.stringify(item))
					})
				}else{
					let data={
						ydNumber:this.ydNumber,
						type:'add'
					}
					uni.navigateTo({
						url: "/pages/sampleplot/sampleplot/richness?data="+ encodeURIComponent(JSON
						.stringify(data))
					})
				}
			}
		}
	}
</script>

<style scoped>
@import '@/common/uni-nvue.css';
.uni-panel-h{
	margin-top: 10rpx;
}
</style>
